package com.itheima.tanhuan.vo.mongo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResult<T> {
    private Integer counts;
    private Integer pagesize;
    private Integer pages;
    private Integer page;
    private List<T> items;

    public PageResult(Integer page,Integer pagesize,List<T> items){
        this.page=page;
        this.pagesize=pagesize;

        this.items=items;
    }
    public PageResult(Integer page,Integer pagesize){
        this.page=page;
        this.pagesize=pagesize;
    }

    public PageResult(Integer page,Integer pagesize,Integer counts,List<T> items){
        this.page=page;
        this.pagesize=pagesize;
        this.counts=counts;
        this.pages=counts/pagesize+1;
        this.items=items;
    }
}
